USE `ft1`;

DROP procedure IF EXISTS `CreateNewUser`;



DELIMITER $$

USE `ft1`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateNewUser`(IN p_fullName varchar(200),IN p_email varchar(200),IN p_pass varchar(45), out statusCode varchar(2))

BEGIN

if p_email in (select `email` from `users`) then

set statusCode = '1';

else 

INSERT INTO `users`

(`fullName`,`email`,`password`,`registrationDt`,`lastlogin`)

VALUES

(p_fullName,p_email,MD5(p_pass),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);

set statusCode = '0';

end if;

END

$$



DELIMITER ;

